<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
  <meta name="generator" content=
  "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org">

  <title>C/C++ Data Types</title>
  <link href="cppreference.css" rel="stylesheet" type="text/css">
</head>

<body>
<table>
  <tr>
  <td>
  <div class="body-content">

  <div class="header-box">
    <a href="index.html">cppreference.com</a> &gt; C/C++ Data Types
  </div>

  <h1>C/C++ Data Types</h1>

  <p>There are five data types for C: <strong>void</strong>,
  <strong>int</strong>, <strong>float</strong>,
  <strong>double</strong>, and <strong>char</strong>.</p>

  <table class="misc-table">
    <tr class="misc-table-tr-1">
      <th>Type</th>

      <th>Description</th>
    </tr>

    <tr class="misc-table-tr-2">
      <td>void</td>

      <td>associated with no data type</td>
    </tr>

    <tr class="misc-table-tr-1">
      <td>int</td>

      <td>integer</td>
    </tr>

    <tr class="misc-table-tr-2">
      <td>float</td>

      <td>floating-point number</td>
    </tr>

    <tr class="misc-table-tr-1">
      <td>double</td>

      <td>double precision floating-point number</td>
    </tr>

    <tr class="misc-table-tr-2">
      <td>char</td>

      <td>character</td>
    </tr>
  </table><br>
  <br>

  <p>C++ defines two more: <strong>bool</strong> and
  <strong>wchar_t</strong>.</p>

  <table>
    <tr class="misc-table-tr-1">
      <th>Type</th>

      <th>Description</th>
    </tr>

    <tr class="misc-table-tr-2">
      <td>bool</td>

      <td>Boolean value, true or false</td>
    </tr>

    <tr class="misc-table-tr-1">
      <td>wchar_t</td>

      <td>wide character</td>
    </tr>
  </table><br>
  <br>

  <h2>Type Modifiers</h2>

  <p>Several of these types can be modified using
  <strong>signed</strong>, <strong>unsigned</strong>,
  <strong>short</strong>, and <strong>long</strong>. When one of these
  type modifiers is used by itself, a data type of <strong>int</strong>
  is assumed. A complete list of possible data types follows:</p>

  <table>
    <tr class="misc-table-tr-2">
      <td>bool</td>
    </tr>

    <tr class="misc-table-tr-1">
      <td>char</td>
    </tr>

    <tr class="misc-table-tr-2">
      <td>unsigned char</td>
    </tr>

    <tr class="misc-table-tr-1">
      <td>signed char</td>
    </tr>

    <tr class="misc-table-tr-2">
      <td>int</td>
    </tr>

    <tr class="misc-table-tr-1">
      <td>unsigned int</td>
    </tr>

    <tr class="misc-table-tr-2">
      <td>signed int</td>
    </tr>

    <tr class="misc-table-tr-1">
      <td>short int</td>
    </tr>

    <tr class="misc-table-tr-2">
      <td>unsigned short int</td>
    </tr>

    <tr class="misc-table-tr-1">
      <td>signed short int</td>
    </tr>

    <tr class="misc-table-tr-2">
      <td>long int</td>
    </tr>

    <tr class="misc-table-tr-1">
      <td>signed long int</td>
    </tr>

    <tr class="misc-table-tr-2">
      <td>unsigned long int</td>
    </tr>

    <tr class="misc-table-tr-1">
      <td>float</td>
    </tr>

    <tr class="misc-table-tr-2">
      <td>double</td>
    </tr>

    <tr class="misc-table-tr-1">
      <td>long double</td>
    </tr>

    <tr class="misc-table-tr-2">
      <td>wchar_t</td>
    </tr>
  </table>

  <h2>Type Sizes and Ranges</h2>

  <p>The size and range of any data type is compiler and architecture
  dependent. The &quot;cfloat&quot; (or &quot;float.h&quot;) header
  file often defines minimum and maximum values for the various data
  types. You can use the <a href="keywords/sizeof.html">sizeof</a>
  operator to determine the size of any data type, in bytes. However,
  many architectures implement data types of a standard size.
  <strong>ints</strong> and <strong>floats</strong> are often 32-bit,
  <strong>chars</strong> 8-bit, and <strong>doubles</strong> are
  usually 64-bit. <strong>bools</strong> are often implemented as 8-bit
  data types.</p>
  </div>
  </td>
  



  </tr>
  </table>
</body></html>
